// pages/sendOrders/sendOrders.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    fileList: [
      {
        url: 'https://img.yzcdn.cn/vant/leaf.jpg',
        name: '图片1',
      },
    ],
    state: {},
      formList: [
        {label: '任务名称', prop: 'test1', type: 'text'},
        {label: '任务描述', prop: 'test2', type: 'text'},
        {label: '任务地点', prop: 'test4', type: 'text'},
        {label: '开始时间', prop: 'test5', type: 'text'},
        {label: '结束时间', prop: 'test6', type: 'text'},
        {label: '当前油价', prop: 'test7', type: 'text'},
        {label: '备注', prop: 'test8', type: 'text'},
        {label: '所属组织', prop: 'test9', type: 'select'},
        {label: '经度', prop: 'test10', type: 'text'},
        {label: '纬度', prop: 'test11', type: 'text'},
      ],
      columns: [],
      openProp: ''
  },
  switchSelect() {
    this.setData({
      selectShow: !this.data.selectShow
    })
  },
  opSelect({target}) {
    this.setData({
      openProp: target.dataset.prop,
      columns: [
        {text: '测试选项1', value: 1},
        {text: '测试选项2', value: 2},
        {text: '测试选项3', value: 3},
        {text: '测试选项4', value: 4},
      ]
    }, () => this.switchSelect())
  },
  onChange({target, detail}) {
    let state = {};
    state[target.datase.prop] = detail;
    this.setData({
      state: {
        ...this.data.state,
        ...state
      }
    })
  },
  selectConfirm({detail}) {
    console.log(detail.value);
    let state = {};
    state[this.data.openProp] = detail.value;
    this.setData({
      state: {
        ...this.data.state,
        ...state
      }
    }, () => this.switchSelect())
  },
})